home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: Feb 2002
- // Author: dbrins
- //
- // Description:
- //
- // Option box for the createPond command
- //
-
- //
- // Procedure Name:
- // setOptionVars
- //
- // Description:
- // Initialize the option values.
- //
- // Input Arguments:
- // Whether to set the options to default values.
- //
- // Return Value:
- // None.
- //
- proc setOptionVars(int $forceFactorySettings)
- {
- if ($forceFactorySettings || !`optionVar -exists createPondSize`) {
- optionVar -floatValue createPondSize 20.0;
- }
- }
-
- //
- // Procedure Name:
- // createPondSetup
- //
- // Description:
- // Update the state of the option box UI to reflect the option values.
- //
- // Input Arguments:
- // parent - Top level parent layout of the option box UI.
- // Required so that UI object names can be
- // successfully resolved.
- //
- // forceFactorySettings - Whether the option values should be set to
- // default values.
- //
- // Return Value:
- // None.
- //
- global proc createPondSetup(string $parent, int $forceFactorySettings)
- {
- // Retrieve the option settings
- //
- setOptionVars($forceFactorySettings);
-
- setParent $parent;
-
- // Query the optionVar's and set the values into the controls.
-
- floatSliderGrp -edit
- -v `optionVar -query createPondSize`
- createPondSize;
-
- }
-
- //
- // Procedure Name:
- // createPondCallback
- //
- // Description:
- // Update the option values with the current state of the option box UI.
- //
- // Input Arguments:
- // parent - Top level parent layout of the option box UI. Required so
- // that UI object names can be successfully resolved.
- //
- // doIt - Whether the command should execute.
- //
- // Return Value:
- // None.
- //
- global proc createPondCallback(string $parent, int $doIt)
- {
- setParent $parent;
-
- // Set the optionVar's from the control values, and then
- // perform the command.
-
- optionVar -floatValue createPondSize
- `floatSliderGrp -query -v createPondSize`;
-
- if ($doIt) {
- performCreatePond 0;
- }
- }
-
- //
- // Procedure Name:
- // createPondOptions
- //
- // Description:
- // Construct the option box UI. Involves accessing the standard option
- // box and customizing the UI accordingly.
- //
- // Input Arguments:
- // None.
- //
- // Return Value:
- // None.
- //
- proc createPondOptions()
- {
- // Name of the command for this option box.
- //
- string $commandName = "createPond";
-
- // Build the option box actions.
- //
- string $callback = ($commandName + "Callback");
- string $setup = ($commandName + "Setup");
-
- string $layout = getOptionBox();
- setParent $layout;
-
- setOptionBoxCommandName($commandName);
-
- setUITemplate -pushTemplate DefaultTemplate;
-
- waitCursor -state 1;
-
- tabLayout -tabsVisible 0 -scrollable 1;
-
- string $parent = `columnLayout -adjustableColumn 1`;
-
- floatSliderGrp
- -label "Size"
- -field 1
- -min 0.0
- -max 100.0
- -fieldMinValue 0.0
- -fieldMaxValue 1000000.0
- -pre 2
- createPondSize;
-
- waitCursor -state 0;
-
- setUITemplate -popTemplate;
-
- // 'Create' button.
- //
- string $applyBtn = getOptionBoxApplyBtn();
- button -edit
- -label "Create Pond"
- -command ($callback + " " + $parent + " " + 1)
- $applyBtn;
-
- // 'Save' button.
- //
- string $saveBtn = getOptionBoxSaveBtn();
- button -edit
- -command ($callback + " " + $parent + " " + 0 + "; hideOptionBox")
- $saveBtn;
-
- // 'Reset' button.
- //
- string $resetBtn = getOptionBoxResetBtn();
- button -edit
- -command ($setup + " " + $parent + " " + 1)
- $resetBtn;
-
- setOptionBoxTitle("Create Pond");
-
- // Customize the 'Help' menu item text.
- //
- setOptionBoxHelpTag( "CreatePond" );
-
- eval (($setup + " " + $parent + " " + 0));
-
- showOptionBox();
- }
-
- //
- // Procedure Name:
- // createPondHelp
- //
- // Description:
- // Return a short description about this command.
- //
- // Input Arguments:
- // None.
- //
- // Return Value:
- // string.
- //
- proc string createPondHelp()
- {
- return
- " Command: createPond - Create a fluid water surface simulation.\n" +
- "Selection: None";
- }
-
- //
- // Procedure Name:
- // assembleCmd
- //
- // Description:
- // Construct the command that will apply the option box values.
- //
- // Input Arguments:
- // None.
- //
- proc string assembleCmd()
- {
- string $cmd = "createPond";
-
- setOptionVars(false);
-
- $cmd = ($cmd
- + " " + `optionVar -query createPondSize`
- );
-
- return $cmd;
- }
-
- //
- // Procedure Name:
- // performCreatePond
- //
- // Description:
- // Perform the createPond command using the corresponding
- // option values.
- //
- // Input Arguments:
- // 0 - Execute the command.
- // 1 - Show the option box dialog.
- // 2 - Return the command.
- //
- global proc string performCreatePond(int $action)
- {
- string $cmd = "";
-
- switch ($action) {
-
- // Execute the command.
- //
- case 0:
- $cmd = `assembleCmd`;
- eval($cmd);
- break;
-
- // Show the option box.
- //
- case 1:
- createPondOptions;
- break;
-
- // Return the command string.
- //
- case 2:
- // Get the command.
- //
- $cmd = `assembleCmd`;
- break;
- }
- return $cmd;
- }
-
-